import Vue from 'vue'

import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import My from '../views/My.vue'
import Cart from '../views/Cart.vue'
import Kind from '../views/Kind.vue'
import Detail from '../views/Detail.vue'
import Login from '../views/Login.vue'
import Register from '../views/register/Register.vue'
import Reg1 from '../views/register/Reg1.vue'
import Reg2 from '../views/register/Reg2.vue'
import Reg3 from '../views/register/Reg3.vue'
import Footer from '../components/Footer.vue'

//  import Error from '../views/Error.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',//重新定向到home的路由
  },
  {
    path: '/home',
    name: 'Home',
    components: {
      default: Home,
      Footer
    }
  },
  {
    path: '/my', 
    name: 'My',
    components: {
      default: My,
      Footer
    }
  },
  

  {
    path: '/cart',
    name: 'Cart',
    components: {
      default:Cart,
      Footer
    }
  },
  {
    path: '/kind',
    name: 'Kind',
    components: {
      default: Kind,
      Footer
    }
  },
  {
    path: '/login', 
    name: 'Login',
    component:Login
  },
  {
    path: '/register', 
    name: 'Register',
    component: Register,
    redirect: '/register/one', 
    children: [
      {
        path: '/register/one', 
        name: 'Reg1',
        component:Reg1
      },
      {
        path: '/register/two', 
        name: 'Reg2',
        component:Reg2
      },
      {
        path: '/register/three', 
        name: 'Reg3',
        component:Reg3
      }
    ]
    
  },
  {
    path: '/detail/:proid',
    name: 'Detail',
    component: Detail
  },
  // { 
  //   path: '*',//不是home的路由，定向到error路由
  //   name: 'Error',
  //   component: Error
  // },

]

const router = new VueRouter({
  routes
})

export default router
